import React, {useEffect, useState} from 'react';
import PropTypes from 'prop-types';

Index2.propTypes = {

};

function Index2(props) {
    const [state,setState]=useState({count:0});
    useEffect(()=>{

    },[])
    return (
        <div>
            <p>You clicked {state.count} times</p>
            <button onClick={() => {
                let num=state.count+1;
                setState({count:num})
            }}>
                Click me
            </button>
        </div>
    );
}
export const Index2 = (props) => {
    useEffect(()=>{
        window.onresize=()=>{
            console.log("onresize")
        }
        let timer=setInterval(()=>{
            console.log("111")
        },1000)
        return ()=>{
            window.onresize=null;
            clearInterval(timer)
        }
    },[])
    return (
        <div>

        </div>
    );
};
export default Index2;
